package cn.wzx.core.translation.aop.service;

import cn.wzx.core.translation.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wzx
 * @date 2024/11/11 10:26
 * @description: redis
 */
@Service
public class RedisTranslator implements Translator{

    @Autowired
    private RedisUtils redisUtils;

    @Override
    public Object translate(String redisKey , String translateField ) {
        //  根据redisSource 拿到redis中对应key的数据  进行返回  （redis 返回Map）
        String value = (String) redisUtils.get(redisKey);
        Map<String ,String> map = new HashMap<>();
        map.put(translateField,value);
        return map;
    }
}
